package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.CheckItemMapper;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import com.itheima.service.CheckItemService;
import com.itheima.support.PageResult;
import com.itheima.support.QueryPageBean;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;

@DubboService
public class CheckItemServiceImpl extends ServiceImpl<CheckItemMapper,CheckItem>implements CheckItemService {
    /**
     * 分页查询实现
     * @param pageBean
     * @return
     */
    @Override
    public PageResult findByPage(QueryPageBean pageBean) {

        IPage<CheckItem>page=this.page(new Page<>(pageBean.getCurrentPage(),pageBean.getPageSize()));

        return new PageResult(page.getTotal(),page.getRecords());
    }

    @Override
    public List<CheckItem> findByGroupId(Long groupId) {
        return baseMapper.findByGroupId(groupId);
    }
}
